<template>
  <div>
    <h3>父组件</h3>
    <hr />
    <!-- 把兄弟组件中公用的数据提升到它们的父组件中，从而实现兄弟间的通信 -->
    <child1 :count="count" />
    <child2 @addCount="addCount" />
  </div>
</template>

<script>
import child1 from '@/components/child/child1.vue'
import child2 from '@/components/child/child2.vue'

export default {
  components: {
    child1,
    child2
  },
  data() {
    return {
      count: 100
    }
  },
  methods: {
    addCount(n) {
      this.count += n
    }
  }
}
</script>

<style lang="scss" scoped></style>
